import requests
import ssl
import re
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context


def sysid(msg):
    print(msg.text)
    sys_code = msg.text
    sys_code = str.upper(sys_code)
    content = {'get_post': '1','code_cmd': '生成密码'.encode('gb2312'), 'sys_code': sys_code}
    #print(content)
    #res = requests.post('https://10.1.7.246:2004/getrootpasswd.php', data=content, verify=False)
    res = requests.post('https://10.19.53.212:2004/getrootpasswd.php', data=content, verify=False)

    #print(res.text)
    text = res.text
    text = re.findall("序列号为:.+</font>", text)
    #print(text)
    result = re.findall("(?<=\:).*?(?=\<)",text[0])
    ret= []
    for x in result:
        #print(x)
        ret.append(x)

    return ret
